package com.xh.audit.vo.webform;

import com.mybatisflex.core.query.QueryWrapper;
import com.xh.audit.entity.unituser.ExternalAuditAgency;
import lombok.Data;
import lombok.EqualsAndHashCode;

import static com.xh.audit.entity.unituser.table.ExternalAuditAgencyTableDef.EXTERNAL_AUDIT_AGENCY;

@Data
@EqualsAndHashCode(callSuper = true)
public class ExternalAuditAgencyQuery extends PageParams<ExternalAuditAgency> {
    private String name;
    private Integer cooperativeUnit;
    private String cooperativeSector;

    public QueryWrapper queryWrapperBuild() {
        QueryWrapper queryWrapper = QueryWrapper.create()
                .and(EXTERNAL_AUDIT_AGENCY.COOPERATIVE_UNIT.eq(cooperativeUnit))
                .and(EXTERNAL_AUDIT_AGENCY.COOPERATIVE_SECTOR.eq(cooperativeSector))
                .and(EXTERNAL_AUDIT_AGENCY.NAME.likeLeft(name));
        return queryWrapper;
    }
}
